<?xml version="1.0" encoding="utf-8" ?>
<sqlMap namespace="TProjectDispatch" xmlns="http://ibatis.apache.org/mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<alias>
    <typeAlias alias="TProjectDispatch" type="EIA.PM.Model.TProjectDispatch, EIA.PM.Model" />
</alias>

<resultMaps>
<resultMap id="select-tprojectdispatch-result" class="TProjectDispatch">
<constructor>
    <argument argumentName="prj_aid" column="prj_aid"/>
    <argument argumentName="prj_name" column="prj_name"/>
    <argument argumentName="prj_type_name" column="prj_type_name"/>
    <argument argumentName="prj_cons_org" column="prj_cons_org"/>
    <argument argumentName="prj_region" column="prj_region"/>
    <argument argumentName="prj_fee" column="prj_fee"/>
    <argument argumentName="prj_contact" column="prj_contact"/>
    <argument argumentName="prj_contact_tel" column="prj_contact_tel"/>
    <argument argumentName="prj_source" column="prj_source"/>
    <argument argumentName="prj_des" column="prj_des"/>
    <argument argumentName="dispatch_dep_id" column="dispatch_dep_id"/>
    <argument argumentName="dispatch_dep_name" column="dispatch_dep_name"/>
    <argument argumentName="dispatch_stf_id" column="dispatch_stf_id"/>
    <argument argumentName="dispatch_stf_name" column="dispatch_stf_name"/>
    <argument argumentName="_sugguestion" column="_sugguestion"/>
    <argument argumentName="_remark" column="_remark"/>
    <argument argumentName="_date" column="_date"/>
    <argument argumentName="_staff" column="_staff"/>
</constructor>
<!--
    <result property="PrjAid" column="prj_aid"/>
    <result property="PrjName" column="prj_name"/>
    <result property="PrjTypeName" column="prj_type_name"/>
    <result property="PrjConsOrg" column="prj_cons_org"/>
    <result property="PrjRegion" column="prj_region"/>
    <result property="PrjFee" column="prj_fee"/>
    <result property="PrjContact" column="prj_contact"/>
    <result property="PrjContactTel" column="prj_contact_tel"/>
    <result property="PrjSource" column="prj_source"/>
    <result property="PrjDes" column="prj_des"/>
    <result property="DispatchDepId" column="dispatch_dep_id"/>
    <result property="DispatchDepName" column="dispatch_dep_name"/>
    <result property="DispatchStfId" column="dispatch_stf_id"/>
    <result property="DispatchStfName" column="dispatch_stf_name"/>
    <result property="Sugguestion" column="_sugguestion"/>
    <result property="Remark" column="_remark"/>
    <result property="Date" column="_date"/>
    <result property="Staff" column="_staff"/>
-->
</resultMap>
</resultMaps>

<statements>
<sql id="sql_TProjectDispatch_where_pk">
WHERE prj_aid=#PrjAid#
</sql>

<sql id="sql_TProjectDispatch_where_cv">
<dynamic prepend="WHERE">
    <isPropertyAvailable property="PrjAid" prepend="AND">prj_aid=#PrjAid#</isPropertyAvailable>
    <isPropertyAvailable property="PrjName" prepend="AND">prj_name LIKE concat('%', #PrjName#, '%')</isPropertyAvailable>
    <isPropertyAvailable property="PrjTypeName" prepend="AND">prj_type_name LIKE concat('%', #PrjTypeName#, '%')</isPropertyAvailable>
    <isPropertyAvailable property="PrjConsOrg" prepend="AND">prj_cons_org LIKE concat('%', #PrjConsOrg#, '%')</isPropertyAvailable>
    <isPropertyAvailable property="PrjRegion" prepend="AND">prj_region=#PrjRegion#</isPropertyAvailable>
    <isPropertyAvailable property="PrjFee" prepend="AND">prj_fee=#PrjFee#</isPropertyAvailable>
    <isPropertyAvailable property="PrjContact" prepend="AND">prj_contact LIKE concat('%', #PrjContact#, '%')</isPropertyAvailable>
    <isPropertyAvailable property="PrjContactTel" prepend="AND">prj_contact_tel LIKE concat('%', #PrjContactTel#, '%')</isPropertyAvailable>
    <isPropertyAvailable property="PrjSource" prepend="AND">prj_source=#PrjSource#</isPropertyAvailable>
    <isPropertyAvailable property="PrjDes" prepend="AND">prj_des LIKE concat('%', #PrjDes#, '%')</isPropertyAvailable>
    <isPropertyAvailable property="DispatchDepId" prepend="AND">dispatch_dep_id=#DispatchDepId#</isPropertyAvailable>
    <isPropertyAvailable property="DispatchDepName" prepend="AND">dispatch_dep_name LIKE concat('%', #DispatchDepName#, '%')</isPropertyAvailable>
    <isPropertyAvailable property="DispatchStfId" prepend="AND">dispatch_stf_id=#DispatchStfId#</isPropertyAvailable>
    <isPropertyAvailable property="DispatchStfName" prepend="AND">dispatch_stf_name LIKE concat('%', #DispatchStfName#, '%')</isPropertyAvailable>
    <isPropertyAvailable property="Sugguestion" prepend="AND">_sugguestion LIKE concat('%', #Sugguestion#, '%')</isPropertyAvailable>
    <isPropertyAvailable property="Remark" prepend="AND">_remark LIKE concat('%', #Remark#, '%')</isPropertyAvailable>
    <isPropertyAvailable property="Date" prepend="AND">_date=#Date#</isPropertyAvailable>
    <isPropertyAvailable property="Staff" prepend="AND">_staff=#Staff#</isPropertyAvailable>
</dynamic>
</sql>

<sql id="sql_TProjectDispatch_set_cols">
<dynamic prepend="SET">
    <isPropertyAvailable property="PrjName" prepend=",">prj_name=#PrjName#</isPropertyAvailable>
    <isPropertyAvailable property="PrjTypeName" prepend=",">prj_type_name=#PrjTypeName#</isPropertyAvailable>
    <isPropertyAvailable property="PrjConsOrg" prepend=",">prj_cons_org=#PrjConsOrg#</isPropertyAvailable>
    <isPropertyAvailable property="PrjRegion" prepend=",">prj_region=#PrjRegion#</isPropertyAvailable>
    <isPropertyAvailable property="PrjFee" prepend=",">prj_fee=#PrjFee#</isPropertyAvailable>
    <isPropertyAvailable property="PrjContact" prepend=",">prj_contact=#PrjContact#</isPropertyAvailable>
    <isPropertyAvailable property="PrjContactTel" prepend=",">prj_contact_tel=#PrjContactTel#</isPropertyAvailable>
    <isPropertyAvailable property="PrjSource" prepend=",">prj_source=#PrjSource#</isPropertyAvailable>
    <isPropertyAvailable property="PrjDes" prepend=",">prj_des=#PrjDes#</isPropertyAvailable>
    <isPropertyAvailable property="DispatchDepId" prepend=",">dispatch_dep_id=#DispatchDepId#</isPropertyAvailable>
    <isPropertyAvailable property="DispatchDepName" prepend=",">dispatch_dep_name=#DispatchDepName#</isPropertyAvailable>
    <isPropertyAvailable property="DispatchStfId" prepend=",">dispatch_stf_id=#DispatchStfId#</isPropertyAvailable>
    <isPropertyAvailable property="DispatchStfName" prepend=",">dispatch_stf_name=#DispatchStfName#</isPropertyAvailable>
    <isPropertyAvailable property="Sugguestion" prepend=",">_sugguestion=#Sugguestion#</isPropertyAvailable>
    <isPropertyAvailable property="Remark" prepend=",">_remark=#Remark#</isPropertyAvailable>
    <isPropertyAvailable property="Date" prepend=",">_date=#Date#</isPropertyAvailable>
    <isPropertyAvailable property="Staff" prepend=",">_staff=#Staff#</isPropertyAvailable>
</dynamic>
</sql>

<select id="SelectTProjectDispatch" parameterClass="" resultMap="TProjectDispatch.select-tprojectdispatch-result">
SELECT *
FROM t_project_dispatch
<include refid="sql_TProjectDispatch_where_pk"/><!--where-->
</select>

<select id="SelectTProjectDispatch_CV" parameterClass="System.Collections.IDictionary" resultMap="TProjectDispatch.select-tprojectdispatch-result">
SELECT *
FROM t_project_dispatch
<include refid="sql_TProjectDispatch_where_cv"/><!--where-->
</select>

<insert id="InsertTProjectDispatch" parameterClass="TProjectDispatch">
<!--pre selectKey place-->
INSERT INTO t_project_dispatch(
<dynamic prepend=" ">
    <isPropertyAvailable property="PrjName" prepend=",">prj_name</isPropertyAvailable>
    <isPropertyAvailable property="PrjTypeName" prepend=",">prj_type_name</isPropertyAvailable>
    <isPropertyAvailable property="PrjConsOrg" prepend=",">prj_cons_org</isPropertyAvailable>
    <isPropertyAvailable property="PrjRegion" prepend=",">prj_region</isPropertyAvailable>
    <isPropertyAvailable property="PrjFee" prepend=",">prj_fee</isPropertyAvailable>
    <isPropertyAvailable property="PrjContact" prepend=",">prj_contact</isPropertyAvailable>
    <isPropertyAvailable property="PrjContactTel" prepend=",">prj_contact_tel</isPropertyAvailable>
    <isPropertyAvailable property="PrjSource" prepend=",">prj_source</isPropertyAvailable>
    <isPropertyAvailable property="PrjDes" prepend=",">prj_des</isPropertyAvailable>
    <isPropertyAvailable property="DispatchDepId" prepend=",">dispatch_dep_id</isPropertyAvailable>
    <isPropertyAvailable property="DispatchDepName" prepend=",">dispatch_dep_name</isPropertyAvailable>
    <isPropertyAvailable property="DispatchStfId" prepend=",">dispatch_stf_id</isPropertyAvailable>
    <isPropertyAvailable property="DispatchStfName" prepend=",">dispatch_stf_name</isPropertyAvailable>
    <isPropertyAvailable property="Sugguestion" prepend=",">_sugguestion</isPropertyAvailable>
    <isPropertyAvailable property="Remark" prepend=",">_remark</isPropertyAvailable>
    <isPropertyAvailable property="Date" prepend=",">_date</isPropertyAvailable>
    <isPropertyAvailable property="Staff" prepend=",">_staff</isPropertyAvailable>
</dynamic>
)VALUES(
<dynamic prepend=" ">
    <isPropertyAvailable property="PrjName" prepend=",">#PrjName#</isPropertyAvailable>
    <isPropertyAvailable property="PrjTypeName" prepend=",">#PrjTypeName#</isPropertyAvailable>
    <isPropertyAvailable property="PrjConsOrg" prepend=",">#PrjConsOrg#</isPropertyAvailable>
    <isPropertyAvailable property="PrjRegion" prepend=",">#PrjRegion#</isPropertyAvailable>
    <isPropertyAvailable property="PrjFee" prepend=",">#PrjFee#</isPropertyAvailable>
    <isPropertyAvailable property="PrjContact" prepend=",">#PrjContact#</isPropertyAvailable>
    <isPropertyAvailable property="PrjContactTel" prepend=",">#PrjContactTel#</isPropertyAvailable>
    <isPropertyAvailable property="PrjSource" prepend=",">#PrjSource#</isPropertyAvailable>
    <isPropertyAvailable property="PrjDes" prepend=",">#PrjDes#</isPropertyAvailable>
    <isPropertyAvailable property="DispatchDepId" prepend=",">#DispatchDepId#</isPropertyAvailable>
    <isPropertyAvailable property="DispatchDepName" prepend=",">#DispatchDepName#</isPropertyAvailable>
    <isPropertyAvailable property="DispatchStfId" prepend=",">#DispatchStfId#</isPropertyAvailable>
    <isPropertyAvailable property="DispatchStfName" prepend=",">#DispatchStfName#</isPropertyAvailable>
    <isPropertyAvailable property="Sugguestion" prepend=",">#Sugguestion#</isPropertyAvailable>
    <isPropertyAvailable property="Remark" prepend=",">#Remark#</isPropertyAvailable>
    <isPropertyAvailable property="Date" prepend=",">#Date#</isPropertyAvailable>
    <isPropertyAvailable property="Staff" prepend=",">#Staff#</isPropertyAvailable>
</dynamic>
)
<selectKey resultClass="int" type="post" property="PrjAid" >
SELECT LAST_INSERT_ID()
</selectKey>
</insert>

<update id="UpdateTProjectDispatch" parameterClass="System.Collections.IDictionary">
UPDATE t_project_dispatch
<include refid="sql_TProjectDispatch_set_cols"/><!--set-->
<include refid="sql_TProjectDispatch_where_pk"/><!--where-->
</update>

<delete id="DeleteTProjectDispatch" parameterClass="">
DELETE FROM t_project_dispatch
<include refid="sql_TProjectDispatch_where_pk"/><!--where-->
</delete>

<statement id="DeleteTProjectDispatch_CV" parameterClass="TProjectDispatch">
DELETE FROM t_project_dispatch
<include refid="sql_TProjectDispatch_where_cv"/><!--where-->
</statement>

<delete id="ClearTProjectDispatch">
DELETE FROM t_project_dispatch
</delete>
</statements>
</sqlMap>